#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
  int i,j,ii,jj,n,sum;
  //char **p;
  while(~scanf("%d",&n))
  {
    sum = 0;
    int *p = (int *)calloc(n*n,sizeof(int));
    // p[i][j]=p[i*n+j];
      for ( j = n - 1;  j >= 0 ; j--)
      {
        ii = 0;
        jj = j;
        star1:
        if(ii<n&&jj<n)
        {
          sum = sum + 1;
          p[ii * n + jj] = sum;
          ii++;
          jj++;
          goto star1;
        }
      }
       for ( i = 1;  i < n ; i++)
      {
        ii = i;
        jj = 0;
        star2:
        if(ii<n&&jj<n)
        {
          sum = sum + 1;
          p[ii * n + jj] = sum;
          ii++;
          jj++;
          goto star2;
        }
      }
    for (int i = 0; i < n; i++)
		{
      for (int j = 0; j < n-1; j++)
		{	 
		    if(p[i*n+j]<10)
		    printf("%d  ", p[i*n+j]);
		    else if(p[i*n+j]<100)
		    printf("%d ", p[i*n+j]);
		    else
		    printf("%d", p[i*n+j]);
		}
	  if(p[i*n+j]<10)
		printf("%d  \n", p[i*n+n-1]);
	  else if(p[i*n+j]<100)
		printf("%d \n", p[i*n+n-1]);
	  else
		printf("%d\n", p[i*n+n-1]);
    }
    free(p);
  }
    return 0;
}